<?php if ($posts = $this->getPosts()): ?>
<?php 
$online_array=array();
$offline_array=array();
foreach ($posts as $post) {
	$cats=$post->getCats();
	if(array_key_exists('Online',$cats)){
		$online_array[]=$post;
	}elseif(array_key_exists('Offline',$cats)){
		$offline_array[]=$post;
	}
}

?>
<h3>Client Portfolio</h3>
<h4>Online</h4>
<ul class="sidenav">
	<?php 
	foreach ($online_array as $item) {
		echo '<li><a href="'.$item->getAddress().'">'.$item->getTitle().'</a></li>';
	}
	?>
</ul>
<h4>Offline</h4>
<ul class="sidenav">
	<?php 
	foreach ($offline_array as $item) {
		echo '<li><a href="'.$item->getAddress().'">'.$item->getTitle().'</a></li>';
	}
	?>
</ul>
<?php endif;?>